﻿using System;
using System.IO;
using NUnit.Framework;


namespace NoFake.IO.Tests
{
    public class FileFactoryTest
    {
        [TestCase(@"1.jpg")]
        [TestCase(@"017e009b-b11a-4a10-80fc-5c9156c80fcd.txt")]
        [TestCase(@"017e009b-b11a-4a10-80fc-5c9156c80fcd.txt")]
        public void GetEmpty_FileName_FileExist(string fileName)
        {
            using (var f = FileFactory.New(fileName))
            {
                Assert.True(File.Exists(f.FullPath));
            }
        }

        [Test]
        public void AddFileToFolder()
        {
            using (var d = DirectoryFactory.New())
            using (var f = FileFactory.Add(d, "1"))
            {
                Assert.That(File.Exists(f.FullPath), Is.True);
            }
        }

        [Test]
        public void AddFile_SeparatorPath_Throw()
        {
            using (var d = DirectoryFactory.New())
            {
                Assert.Throws<Exception>(() => FileFactory.Add(d, @"1\1"));
            }
        }
    }
}